package Filter;


import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author lishunlin110
 * @version 1.0
 * @description: 编码过滤器
 * @date 2021/8/26 22:32
 */
@WebFilter(value = "/Manager/*")
public class EnCodingFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        servletRequest.setCharacterEncoding("UTF-8");
        servletResponse.setContentType("txt/html;charset=UTF-8");
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
